#!/bin/bash

DIR="$( cd "$( dirname "$0" )" && pwd )"

source $DIR/experiment-variables.sh
source $DIR/env.sh

SSH_OPTS='-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'

#echo "$EXPLOCATION $EXPTYPE"

for client in $JMETERCLIENT; do
	targetdir="$DIR/results/${EXPLOCATION}-${EXPTYPE}/$(date +%Y-%m-%d_%H-%M)"
	mkdir -p $targetdir
	echo "Starting java processes from $client"
	scp $SSH_OPTS -i $SSH_KEY $USER@$client:$TARGET_LOCATION/$JMETER_DIR/*.{jtl,log} $targetdir
	scp $SSH_OPTS -i $SSH_KEY $USER@$client:$TARGET_LOCATION/*.log $targetdir 
done

